/**
 * @description Model category
 *
 * @author Xiongmao
 */
'use strict';

const db = require('../db');

module.exports = db.model('Category', {
    tableName: 'categories',
    hasTimestamps: true,

    parent() {
        return this.belongsTo('Category', 'parent_id');
    },

    children() {
        return this.hasMany('Category', 'parent_id');
    }
}, {
    PENDING: 0,
    ONLINE: 1,
});
